// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   register_draft_ok.java

package logistics.contact;

import include.nseer_cookie.NseerId;
import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class register_draft_ok extends HttpServlet
{

	public register_draft_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			String time = "";
			Date now = new Date();
			SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
			time = formatter.format(now);
			HttpSession session = request.getSession();
			nseer_db_backup1 logistics_db = new nseer_db_backup1(dbApplication);
			if (logistics_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String provider_ID = request.getParameter("provider_ID");
				String contact_ID = NseerId.getId(getClass().getResource("").toString(), (String)dbSession.getAttribute("unit_db_name"));
				String reason = request.getParameter("reason");
				String reasonexact = request.getParameter("reasonexact");
				String provider_name = exchange.unURL(request.getParameter("provider_name"));
				String person_contacted = request.getParameter("person_contacted");
				String person_contacted_tel = request.getParameter("person_contacted_tel");
				String contact_person = request.getParameter("contact_person");
				String contact_person_ID = request.getParameter("contact_person_ID");
				String contact_time = request.getParameter("contact_time");
				String contact_type = request.getParameter("contact_type");
				String contact_content = new String(request.getParameter("contact_content").getBytes("UTF-8"), "UTF-8");
				String sql = (new StringBuilder("insert into logistics_contact(contact_ID,reason,reasonexact,provider_ID,provider_name,person_contacted,person_contacted_tel,contact_person,contact_person_ID,contact_time,contact_type,contact_content,check_tag,excel_tag) values ('")).append(contact_ID).append("','").append(reason).append("','").append(reasonexact).append("','").append(provider_ID).append("','").append(provider_name).append("','").append(person_contacted).append("','").append(person_contacted_tel).append("','").append(contact_person).append("','").append(contact_person_ID).append("','").append(contact_time).append("','").append(contact_type).append("','").append(contact_content).append("','5','2')").toString();
				logistics_db.executeUpdate(sql);
				logistics_db.commit();
				logistics_db.close();
				response.sendRedirect("logistics/contact/register_draft_ok.jsp?finished_tag=0");
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
